{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}

<script type="text/javascript">
<!--
var agora_warning_url = '{url task=profile page=preview action=add_warning type=clean user_id=$user.id}';
{literal}
function agora_warning() {
	new Ajax(agora_ban_url, {
			method: 'post',
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();
}
{/literal}

var agora_ban_url = '{url task=profile page=preview action=set_ban user_id=$user.id type=clean}';
{literal}
function agora_ban() {
	new Ajax(agora_ban_url, {
			method: 'post',
			onFailure: function(){},
			onComplete: function(inResponse) {
				var box = SqueezeBox.initialize();
				box.assignOptions();
				box.setContent('string',inResponse);
			}
	}).request();
}
{/literal}

//-->
</script>

<div class="ag_postwrap">
	<div class="ag_rightend">
		<h2 class="ag_headerbar"><span class="ag_middle">##Section preview##</span></h2>
	</div>

	<div class="ag_outerwrap">
		{if $user.banned and $same_user }
		<fieldset>
			<p class="ag_user_banned">
				<strong>##BAN_MESSAGE_PROFILE##</strong><br/><br/>{$ban.message}<br/><br/>
				##Ban will expire at## {if $ban.expire}{$ban.expire|agora_date}{else}##never##{/if}
			</p>
		</fieldset>
		{/if}
		<fieldset>
			<legend class="ag_color">##Section personal##</legend>
			<div class="ag_infldsetprofile">
				<dl>
					<dt>##Username##:</dt>
					<dd>{if $agora_config.o_fullnames_enabled}{$user.name|nomail|escape}{else}{$user.username|nomail|escape}{/if}</dd>

					{if $agora_config.o_prof_title eq '1'}
					<dt>##Title##:</dt>
					<dd>{if empty($user.title)}&nbsp;{else}{$user.title}{/if}</dd>
					{/if}

					{if $agora_config.o_prof_location eq '1'}
					<dt>##Location##:</dt>
					<dd>{if empty($user.location)}##Unknown##{else}{$user.location}{/if}</dd>
					{/if}

					{if $agora_config.o_usermap}
					{if !empty($user.latitude) && !empty($user.longitude)}
					<dt class="map">
						{script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=`$agora_config.o_um_key`"}
						{script src="js/gmap_profile.js"}
						<div id="map" style="width: 400px; height: 300px; "></div>
						<script type="text/javascript">
						//<![CDATA[
						window.addEvent('domready',function(e) {ldelim}
						gMapProfilePreview({$user.longitude},{$user.latitude},{$agora_config.o_um_default_zoom});
						{rdelim});
						//]]>
						</script>
					</dt>
					<dd class="map"></dd>
					{/if}
					{/if}

					{if $agora_config.o_prof_website eq '1'}
					<dt>##Website##:</dt>
					<dd>{if empty($user.url)}&nbsp;{else}<span class="ag_good_link"><a href="{$user.url}" rel="nofollow" target="_blank">{$user.url}</a></span>{/if}</dd>
					{/if}

					{if $agora_config.o_pms_enabled && !$user.is_guest && !$agora_user.is_guest}
					<dt>##PM##:</dt>
					<dd><span class="ag_good_link"><a href="{url task=pms page=compose send_to=$user.id}">##Quick message##</a></span></dd>
					{/if}

					{*
					<dt>##E-mail##:</dt>
					<dd><span class="ag_good_link"><a href="mailto:{$user.email}">{$user.email}</a></span></dd>
					*}

					{if $agora_config.o_prof_gender eq '1'}
					<dt>##Gender##:</dt>
					<dd>{if empty($user.gender)}##Unknown##{elseif $user.gender eq 1}##Gender male##{else}##Gender female##{/if}</dd>
					{/if}

					{if $agora_config.o_prof_dob eq '1'}
					<dt>##Birthday##:</dt>
					<dd>{if $user.hide_age == 0 && !empty($user.birthday)}{$user.birthday}{else}&nbsp;{/if}</dd>
					{/if}

					{if $agora_config.o_prof_interests eq '1'}
					<dt>##Interests##:</dt>
					<dd>{if empty($user.interests)}&nbsp;{else}{$user.interests}{/if}</dd>
					{/if}

					{if $agora_config.o_prof_about eq '1'}
					<dt>##aboutme##:</dt>
					<dd>{if empty($user.aboutme)}&nbsp;{else}{$user.aboutme}{/if}</dd>
					{/if}
				</dl>
			</div>
		</fieldset>

		{if $agora_config.o_prof_messaging eq '1'}
		<fieldset>
			<legend class="ag_color">##Section messaging##</legend>
			<div class="ag_infldsetprofile">
				<dl>
					<dt>##Jabber##:</dt>
					<dd>{if !empty($user.jabber)}{$user.jabber|escape}{else}##Unknown##{/if}</dd>

					<dt>##ICQ##:</dt>
					<dd>{if !empty($user.icq)}{$user.icq|escape}{else}##Unknown##{/if}</dd>

					<dt>##MSN##:</dt>
					<dd>{if !empty($user.msn)}{$user.msn|escape}{else}##Unknown##{/if}</dd>

					<dt>##AOL IM##:</dt>
					<dd>{if !empty($user.aim)}{$user.aim|escape}{else}##Unknown##{/if}</dd>

					<dt>##Yahoo##:</dt>
					<dd>{if !empty($user.yahoo)}{$user.yahoo|escape}{else}##Unknown##{/if}</dd>

					<dt>##XFire##:</dt>
					<dd>{if !empty($user.xfire)}{$user.xfire|escape}{else}##Unknown##{/if}</dd>

					<dt>##Skype##:</dt>
					<dd>{if !empty($user.skype)}{$user.skype|escape}{else}##Unknown##{/if}</dd>
				</dl>
			</div>
		</fieldset>
		{/if}

		<fieldset>
			<legend class="ag_color">##Section personality##</legend>
			<div class="ag_infldsetprofile">
				<dl>
					{if $agora_config.o_avatars == '1'}
					<dt>##Avatar##:</dt>
					<dd class="ag_postavatar">
						<img src="{$user.avatar}" {$user.avatar_size} alt="" />
					</dd>
					{/if}

					{if $agora_config.o_prof_sig eq '1'}
					<dt>##Signature##: </dt>
					<dd>
						{if $user.signature}
						<div class="ag_postmsg">
							{$signature_preview}
							{$user.signature}
						</div>
						{else}##No sig##
						{/if}
					</dd>
					{/if}
				</dl>
			</div>
		</fieldset>

		<fieldset>
			<legend class="ag_color">##User activity##</legend>
			<div class="ag_infldsetprofile">
				<dl>
					<dt>##Posts##:</dt>
					<dd>{if $agora_config.o_show_post_count}
						{$user.num_posts}
						{/if}

						{* TODO: ACL search permissions here *}
						{if $user.g_search}
						&nbsp;-&nbsp;
						<a href="{url task=search action=show_user user_id=$user.id}">##Show posts##</a>
						{/if}
					</dd>

					<dt>##Last post##:</dt>
					<dd>{$user.last_post|agora_date}</dd>

					<dt>##Registered##:</dt>
					<dd>{$user.registered|agora_date}</dd>
					{if $has_aup}
					<dt>##AU_POINTS##:</dt>
					<dd>{$points}</dd>
					{/if}
				</dl>
			</div>
		</fieldset>

		{if (($agora_user.is_admin ) or ($agora_user.is_moderator ))}
		<fieldset>
			<legend class="ag_color">##Moderator Legend##</legend>
			<div class="ag_infldsetprofile">

				<div class="ag_rightend">
					<h2 class="ag_headerbar"><span class="ag_middle">##Manage User Warnings##</span></h2>
				</div>
				<div id="vf" class="ag_tablewrap">
					<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<thead>
							<tr>
								<th class="ag_column">##Warning message##</th>
								<th class="ag_topic3">##Points##</th>
								<th class="ag_spacer">##Posted##</th>
								<th class="ag_spacer">##Expire##</th>
							</tr>
						</thead>
						<tbody>
							{foreach from=$warnings item=warning}
							<tr>
								<td class="ag_column">{$warning.default_message} : {$warning.message}</td>
								<td class="ag_topic3">{$warning.points}</td>
								<td class="ag_spacer">{$warning.posted|agora_date}</td>
								<td class="ag_spacer">{$warning.expire|agora_date}</td>
							</tr>
							{foreachelse}
							<tr>
								<td class="ag_spacer ag_empty_forum" colspan="4">##No warnings##</td>
							</tr>
							{/foreach}
						</tbody>
					</table>
				</div>

				{if $user.banned}
				<div class="ag_clearer"></div><br />
				<p class="ag_user_banned">
					<strong>##User banned##</strong> ({$ban.message})<br/>
				##Ban will expire at## {if $ban.expire}{$ban.expire|agora_date}{else}##never##{/if}
				</p>
				{/if}

				<div class="ag_clearer"></div><br />

				<div class="ag_profile_modMenu">
					<a href="#" onclick="agora_warning();return false;">##Add warning##</a>
					&nbsp;|&nbsp;
					{if $user.banned}
					<a href="{url task=profile page=preview action=unban user_id=$user.id}">##UnBan User##</a>
					{else}
					<a href="#" onclick="agora_ban(); return false;">##Ban User##</a>
					{/if}
				</div>
			</div>
		</fieldset>
		{/if}
	</div>
</div>